package net.aias.springaichat.business.ai.embedding;

import lombok.extern.slf4j.Slf4j;
import net.aias.springaichat.adapter.ai.client.DoubaoEmbeddingClient;
import org.springframework.ai.embedding.EmbeddingResponse;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: cheng.tang
 * @Date: 2025/5/13
 * @Description: spring-ai-chat
 */
@Service
@Slf4j
public class EmbeddingServiceImpl implements EmbeddingService {

    private final DoubaoEmbeddingClient embeddingClient;

    public EmbeddingServiceImpl(DoubaoEmbeddingClient embeddingClient) {
        this.embeddingClient = embeddingClient;
    }

    @Override
    public EmbeddingResponse embedText(String text) {
        return embeddingClient.embed(List.of(text));
    }

}
